package fun.stgoder.test1;

import java.util.concurrent.TimeUnit;

public class TestJoin {
    public static void main(String[] args) throws InterruptedException {

        Thread t1 = new Thread(() -> {
            try {
                TimeUnit.SECONDS.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("t1 finish");
        });
        t1.start();
        t1.join();

        Thread t2 = new Thread(() -> {
            try {
                TimeUnit.SECONDS.sleep(2);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("t2 finish");
        });
        t2.start();
        t2.join();

        Thread t3 = new Thread(() -> {
            try {
                TimeUnit.SECONDS.sleep(3);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("t3 finish");
        });
        t3.start();
        //t3.join();

        System.out.println("finish");
    }
}
